<template>
  <div class="search-form">
    <div class="search-form-inner">
      <div class="search-form-box">
        <input
          class="form-search"
          type="text"
          name="wd"
          v-model="search"
          placeholder="键入搜索关键词"
        />
        <button type="submit" id="btn-search" @click="submit">
          <i class="el-icon-search"></i>
        </button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      search: "",
    };
  },
  methods: {
    submit() {
      let search = this.search;
      this.search = "";
      this.$listeners.target("searchClose");
      this.$router.push({
        path: "/note/search",
        query: {
          keyWord: search,
        },
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.search-form {
  overflow: hidden;
}
.search-form .search-form-inner {
  max-width: 640px;
  padding: 0 20px;
  margin: auto;
  height: 285px;
}
.search-form-inner p {
  margin-top: 10px;
  color: #a0a0a0;
  text-align: center;
  font-size: 20px;
}
.search-form.is-visible {
  display: block;
}
.search-form .search-form-box {
  position: relative;
  margin-bottom: 40px;
}
.search-form input {
  background: #fff;
  display: inline-block;
  line-height: 60px;
  height: 58px;
  color: #949494;
  font-size: 15px;
  border-radius: 3px;
  padding: 0 20px;
  width: 100%;
  border: 1px solid #e2e2e2;
  text-align: left;
  -webkit-appearance: none;
}
.search-form button {
  background: #000;
  display: inline-block;
  line-height: 58px;
  height: 58px;
  width: 100px;
  color: #fff;
  font-size: 15px;
  padding: 0 25px;
  margin: 0;
  border-radius: 0 3px 3px 0;
  position: absolute;
  right: 0;
  top: 0;
}
.search-form input::-webkit-input-placeholder {
  color: #949494;
}
.search-form input:-moz-placeholder {
  color: #949494;
}
.search-form input::-moz-placeholder {
  color: #949494;
}
.search-form input:-ms-input-placeholder {
  color: #949494;
}
</style>